package org.CGlibProxyEnhancer;

import org.springframework.aop.framework.ProxyFactory;

/**
 * Created by chinalin on 2017/3/17.
 */
public class Client {
    public static void main(String[] args) {
        ProxyFactory proxyFactory = new ProxyFactory() ;
        proxyFactory.setTarget(new GreetingImpl());
        proxyFactory.addAdvice(new GreetingAroudAdviec());
//        proxyFactory.addAdvice(new GreetingAfterAdvice());
        GreetingImpl greeting = (GreetingImpl)proxyFactory.getProxy() ;
        greeting.say("jack");
        greeting.say1(false);
        greeting.say2(25);
    }
}
    /**
     *用前置增强和后置增强
     *
    ProxyFactory proxyFactory = new ProxyFactory() ;
        proxyFactory.setTarget(new GreetingImpl());
                proxyFactory.addAdvice(new GreetingBeforeAndAfterAdvice());
//        proxyFactory.addAdvice(new GreetingAfterAdvice());
                GreetingImpl greeting = (GreetingImpl)proxyFactory.getProxy() ;
                greeting.say("jack");
                greeting.say1(false);
                greeting.say2(25);

     */